package com.ruoyi.suggestion.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.suggestion.mapper.CommunityVoteMapper;
import com.ruoyi.suggestion.domain.CommunityVote;
import com.ruoyi.suggestion.service.ICommunityVoteService;

/**
 * 建议投票Service业务层处理
 * 
 * @author xianyu
 * @date 2025-04-03
 */
@Service
public class CommunityVoteServiceImpl implements ICommunityVoteService 
{
    @Autowired
    private CommunityVoteMapper communityVoteMapper;

    /**
     * 查询建议投票
     * 
     * @param id 建议投票主键
     * @return 建议投票
     */
    @Override
    public CommunityVote selectCommunityVoteById(Long id)
    {
        return communityVoteMapper.selectCommunityVoteById(id);
    }

    /**
     * 查询建议投票列表
     * 
     * @param communityVote 建议投票
     * @return 建议投票
     */
    @Override
    public List<CommunityVote> selectCommunityVoteList(CommunityVote communityVote)
    {
        return communityVoteMapper.selectCommunityVoteList(communityVote);
    }

    /**
     * 新增建议投票
     * 
     * @param communityVote 建议投票
     * @return 结果
     */
    @Override
    public int insertCommunityVote(CommunityVote communityVote)
    {
        communityVote.setCreateTime(DateUtils.getNowDate());
        return communityVoteMapper.insertCommunityVote(communityVote);
    }

    /**
     * 修改建议投票
     * 
     * @param communityVote 建议投票
     * @return 结果
     */
    @Override
    public int updateCommunityVote(CommunityVote communityVote)
    {
        return communityVoteMapper.updateCommunityVote(communityVote);
    }

    /**
     * 批量删除建议投票
     * 
     * @param ids 需要删除的建议投票主键
     * @return 结果
     */
    @Override
    public int deleteCommunityVoteByIds(Long[] ids)
    {
        return communityVoteMapper.deleteCommunityVoteByIds(ids);
    }

    /**
     * 删除建议投票信息
     * 
     * @param id 建议投票主键
     * @return 结果
     */
    @Override
    public int deleteCommunityVoteById(Long id)
    {
        return communityVoteMapper.deleteCommunityVoteById(id);
    }
}
